﻿// JScript File

function getParentWin() {
    var w = opener || parent;
    return w != window ? w : null;
}

function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Are you sure you want to log out?'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}




function ChangeStyle(_objectID)
{
    var _object=_objectID;//document.getElementById(_objectID.id);
    if (_object.className == _object.getAttribute("ClassOver"))
        _object.className = _object.getAttribute("ClassOut");
    else
        _object.className = _object.getAttribute("ClassOver");
}

///      zoomBox               //


function zoomBox(url, name, width, height) {

    var winX = 0;
    var winY = 0;
    var w = width;
    var h = height;
    // only set new values if 4.0 browser
    if (parseInt(navigator.appVersion) >= 4) {
        winX = (screen.availWidth - w) * .5;
        winY = (screen.availHeight - h) * .5;
    }
    popupWin = window.open(url, name, 'scrollbars,resizable=yes, width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
}
///////////////////////////////////////////////


function Selects() {


    var win = getParentWin();
    var _el = win.document.getElementById(returnOpenerId);

    var _items = _el.value;
    var els = document.getElementsByTagName("input");
    for (var i = 0; i < els.length; i++) {

        var _object = els[i];
        if (_object.getAttribute("type") == "checkbox" && _object.checked) {
            _items += ((_items == "") ? "" : ",") + _object.value;
        }
    }

    _el.value = _items;
    //alert(_items);

   //self.close();
   
   
}

// Cho vao mục Bookmark hoặc Favorite
function addBookmark(title, url) {
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(title, url,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite( url, title);
        } else {
               alert("Sorry, your browser doesn't support this");
        }
}
function setBookmark(url,str){
if (window.sidebar) { window.sidebar.addPanel(str, url,"");}
//if(str=='')str=url;
else if (document.all){ window.external.AddFavorite(url,str);}
else alert('Bạn vui lòng nhấn đồng thời 2 phím CTRL và D để đưa đường link sau đây vào bookmark:\n"'+url+'".');
} 